export default ({ app }, inject) => {
  //基准域名
  const baseApiUrl = '/api'
  const baseMyUrl = '/my'
  //接口配置
  const _API = {
    login: (data) =>
      app.$requestApi(`${baseApiUrl}/login`, data, 'POST'),
    userInfo: (data) =>
      app.$requestApi(`${baseMyUrl}/userInfo`, data, 'GET'),
    articleList: (data) =>
      app.$requestApi(`${baseMyUrl}/articleList`, data, 'POST'),
    articleDetail: (id) =>
      app.$requestApi(`${baseMyUrl}/articleDetail/`+ id, '', 'GET'),
  }
  //注入到全局nuxt示例中
  inject('api', _API)
}